package scalaapps

import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by yang on 16-12-30.
  */
object FirstApp {
  def main(args: Array[String]) {
    val conf = new SparkConf()
    conf.setAppName("WorkCount").setMaster("local[2]")
    val sc = new SparkContext(conf)
    val line = sc.textFile("hdfs://localhost:9000/NOTICE")
    line.flatMap(_.split(" ")).map((_, 1)).reduceByKey(_ + _).sortBy(x=>x._2).collect().foreach(println)
    //sc.stop()
  }
}
